//思路一：两个指针分类后分别存回数组
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* shuffle(int* nums, int numsSize, int n, int* returnSize) {
    int*ps = (int*)malloc(sizeof(int)*n);
    int*pd = (int*)malloc(sizeof(int)*n);
    for(int i = 0; i < n; i++){
        *(ps + i) = *(nums + i);
    }for(int i = n; i < 2*n; i++){
        *(pd + i - n) = *(nums + i);
    }
    for(int i = 0; i < n; i++){
        *(nums + 2*i) = *(ps + i);
        *(nums + 2*i + 1) = *(pd + i);
    }
    *returnSize = 2 * n;
    return nums;
}

//思路二：一个指针分类存数组，然后返回指针
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* shuffle(int* nums, int numsSize, int n, int* returnSize){
    int *ans = (int *)malloc(sizeof(int) * n * 2);
    for (int i = 0; i < n; i++) {
        ans[2 * i] = nums[i];
        ans[2 * i + 1] = nums[i + n];
    }
    *returnSize = n * 2;
    return ans;
}

/*给你一个数组 nums ，数组中有 2n 个元素，按 [x1,x2,...,xn,y1,y2,...,yn] 的格式排列。

请你将数组按 [x1,y1,x2,y2,...,xn,yn] 格式重新排列，返回重排后的数组。*/